package com.cpj.bsyyzx.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cpj.bsyyzx.entity.Meals;
import com.cpj.bsyyzx.entity.MealsMenology;
import com.cpj.bsyyzx.service.IMealsMenologyService;
import com.cpj.bsyyzx.util.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 五个臭皮匠
 * @since 2021-04-27
 */
@RestController
@RequestMapping("/mealsMenology")
public class MealsMenologyController {
    @Autowired
    IMealsMenologyService mealsMenologyService;
    @RequestMapping("list")
    CommonResult list(String day){
        QueryWrapper wrapper=new QueryWrapper();
        wrapper.eq("supply_work",day);
        return CommonResult.success(mealsMenologyService.list(wrapper));
    }
    @RequestMapping("save")
    CommonResult save(MealsMenology mealsMenology) {
        return CommonResult.success(mealsMenologyService.saveOrUpdate(mealsMenology));
    }

    @RequestMapping("getById")
    CommonResult getById(Integer id){
        return CommonResult.success(mealsMenologyService.getById(id));
    }
    @RequestMapping("delete")
    public CommonResult delete(Integer foodId){
        boolean success=mealsMenologyService.removeById(foodId);
        return CommonResult.success(success);
    }
}
